import React, { useState, useEffect } from 'react';
import MenuBar from '@/components/MenuBar/index.tsx';
import Header from './components/header';
import './index.less';
import Search from './components/search';
import Hot from './components/hot';
import useHttpHook from '@/hooks/useHttpHook';
import { isEmpty } from 'project-libs';

export default function(props: Object) {
  const [citys, citysLoading]: any = useHttpHook({ url: '/commons/citys' });
  const [houses, housesLoading]: any = useHttpHook({ url: '/house/hot' });

  return (
    <div>
      <MenuBar pathname={'/'} />
      <div className="home">
        <Header />
        {isEmpty(citys) || <Search citys={citys} citysLoading={citysLoading} />}
        {isEmpty(houses) || (
          <Hot houses={houses} housesLoading={housesLoading} />
        )}
      </div>
    </div>
  );
}
